{% extends "brand/base.html" %}


{% block content %}
<style>
    table, tr, th, td {border: 1px solid #CCC; border-collapse: collapse;}
</style>
<p>Found {{ brandList|length }} brand{{ brandList|pluralize }}.</p>
{% for brand in brandList %}
    {% if forloop.first %}
    <table>
    <th>
        <td>显示名称</td>
        <td>中文名称</td>
        <td>英文名称</td>
        <td>品牌logo</td>
    </th>
    {% endif %}
    <tr>
        <td>{{ brand.id }}</td>
        <td>{{ brand.show_name }}</td>
        <td>{{ brand.brand_name_zh }}</td>
        <td>{{ brand.brand_name_en }}</td>
        <td><img src="{{ brand.brand_logo }}" onerror="this.src='http://dummyimage.com/300'"></td>
    </tr>
    {% if forloop.last %}
    </table>
    {% endif %}
{% empty %}
    <p>The list is empty!</p>
{% endfor %}
{% endblock %}

{% block search %}
    <form action="/brand/search" method="get">
        <input type="text" name="q" placeholder="请输入品牌名称" value="{{ query }}">
        <input type="submit" value="Search">
    </form>
{% endblock %}

{% block contact %}
{#    {% if form.errors %}#}
{#        <p>Please corrent the error{{ form.errors|pluralize }}</p>#}
{#        {% for error in form.errors %}#}
{#            <p>{{ error }}</p>#}
{#        {% endfor %}#}
{#    {% endif %}#}
    <form action="/brand/contact" method="post">
        {{ form.as_p }}
        <p><input type="submit" value="Submit"></p>
    </form>
{% endblock %}
